#include <string>
#include <opencv2/opencv.hpp>

#include "palmdll.h"

using namespace std;

extern "C"
{
    /*
parameters:
@palmprint_bytes: 128*128,CV_8U
@code_bytes: sizeof(printFeature) chars
*/
    void encode_palmprint_using_bytes(unsigned char *palmprint_bytes, char *code_bytes)
    {
        printFeature *pF2D = new printFeature();
        FeatureExtractionPrint(palmprint_bytes, pF2D);
        memcpy(code_bytes, pF2D, sizeof(printFeature));
        delete pF2D;
    }

    double calculate_codes_distance(char *lhs_code_bytes, char *rhs_code_bytes)
    {
        double score = .0;
        printFeature *A = new printFeature(), *B = new printFeature();
        memcpy(A, lhs_code_bytes, sizeof(printFeature));
        memcpy(B, rhs_code_bytes, sizeof(printFeature));
        score = MatchPrint(A, B);
        return score;
    }
}